﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.CityCommand;
using RBAC.MaHaiBo.API.Application.Command.CountyCommand;
using RBAC.MaHaiBo.Entity;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.CountyHandler
{
    public class CountyCommandHandlers : IRequestHandler<CountyCommand, List<County>>
    {
        ICountyService CountySer;

        public CountyCommandHandlers(ICountyService CountySer)
        {
            this.CountySer = CountySer;
        }

        public async Task<List<County>> Handle(CountyCommand request, CancellationToken cancellationToken)
        {
            return await CountySer.GetCounty(request.CityId);
        }
    }
}
